<template>
	<view class="container">
		<!-- 成功图标 -->
		<view class="success-icon">✅</view>
		
		<!-- 支付成功信息 -->
		<view class="success-info">
			<text class="success-title">支付成功</text>
			<text class="success-amount">¥{{paymentAmount}}</text>
			<text class="success-desc">感谢您的购买，我们会尽快为您发货</text>
		</view>

		<!-- 订单信息 -->
		<view class="order-info">
			<view class="info-item">
				<text class="info-label">订单号</text>
				<text class="info-value">{{orderInfo.orderNo}}</text>
			</view>
			<view class="info-item">
				<text class="info-label">支付时间</text>
				<text class="info-value">{{orderInfo.payTime}}</text>
			</view>
			<view class="info-item">
				<text class="info-label">支付方式</text>
				<text class="info-value">{{orderInfo.payMethod}}</text>
			</view>
		</view>

		<!-- 操作按钮 -->
		<view class="action-buttons">
			<button class="action-btn secondary" @click="viewOrder">查看订单</button>
			<button class="action-btn primary" @click="goHome">继续购物</button>
		</view>

		<!-- 推荐商品 -->
		<view class="recommend-section">
			<view class="section-title">为您推荐</view>
			<scroll-view class="recommend-list" scroll-x="true">
				<view class="recommend-item" v-for="(item, index) in recommendProducts" :key="index" @click="goToProduct(item)">
					<image class="recommend-image" :src="item.image" mode="aspectFill"></image>
					<text class="recommend-name">{{item.name}}</text>
					<text class="recommend-price">¥{{item.price}}</text>
				</view>
			</scroll-view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				paymentAmount: '155.56',
				orderInfo: {
					orderNo: 'YT87897079778868686588',
					payTime: '2024-01-12 11:30:25',
					payMethod: '微信支付'
				},
				recommendProducts: [
					{
						id: 1,
						name: '新鲜橙子',
						price: '29.9',
						image: '/static/orange.png'
					},
					{
						id: 2,
						name: '进口香蕉',
						price: '19.9',
						image: '/static/banana.png'
					},
					{
						id: 3,
						name: '有机葡萄',
						price: '39.9',
						image: '/static/grape.png'
					}
				]
			}
		},
		methods: {
			viewOrder() {
				uni.switchTab({
					url: '/pages/index/no-list'
				});
			},
			goHome() {
				uni.switchTab({
					url: '/pages/index/index'
				});
			},
			goToProduct(product) {
				uni.navigateTo({
					url: `/pages/product/detail?id=${product.id}`
				});
			}
		}
	}
</script>

<style scoped>
.container {
	background-color: #f5f5f5;
	min-height: 100vh;
	padding: 60rpx 30rpx;
}

/* 成功图标 */
.success-icon {
	font-size: 120rpx;
	text-align: center;
	margin-bottom: 40rpx;
}

/* 成功信息 */
.success-info {
	text-align: center;
	margin-bottom: 60rpx;
}

.success-title {
	font-size: 36rpx;
	color: #52c41a;
	font-weight: bold;
	display: block;
	margin-bottom: 20rpx;
}

.success-amount {
	font-size: 48rpx;
	color: #ff4757;
	font-weight: bold;
	display: block;
	margin-bottom: 20rpx;
}

.success-desc {
	font-size: 26rpx;
	color: #666;
	line-height: 1.5;
}

/* 订单信息 */
.order-info {
	background-color: #fff;
	border-radius: 20rpx;
	padding: 30rpx;
	margin-bottom: 40rpx;
}

.info-item {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 20rpx 0;
	border-bottom: 1rpx solid #f0f0f0;
}

.info-item:last-child {
	border-bottom: none;
}

.info-label {
	font-size: 26rpx;
	color: #666;
}

.info-value {
	font-size: 26rpx;
	color: #333;
}

/* 操作按钮 */
.action-buttons {
	display: flex;
	gap: 20rpx;
	margin-bottom: 40rpx;
}

.action-btn {
	flex: 1;
	padding: 25rpx;
	border-radius: 25rpx;
	font-size: 28rpx;
	border: none;
}

.action-btn.secondary {
	background-color: #fff;
	color: #666;
	border: 1rpx solid #ddd;
}

.action-btn.primary {
	background-color: #ff6b35;
	color: white;
}

/* 推荐商品 */
.recommend-section {
	background-color: #fff;
	border-radius: 20rpx;
	padding: 30rpx;
}

.section-title {
	font-size: 32rpx;
	color: #333;
	font-weight: bold;
	margin-bottom: 30rpx;
}

.recommend-list {
	white-space: nowrap;
}

.recommend-item {
	display: inline-block;
	margin-right: 20rpx;
	text-align: center;
	width: 200rpx;
}

.recommend-image {
	width: 160rpx;
	height: 160rpx;
	border-radius: 15rpx;
	margin-bottom: 15rpx;
}

.recommend-name {
	font-size: 24rpx;
	color: #333;
	display: block;
	margin-bottom: 10rpx;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.recommend-price {
	font-size: 26rpx;
	color: #ff4757;
	font-weight: bold;
}
</style>